package com.wf.javase;

/**
 * @author mpk
 * @since 2024/6/22 16:09:26
 */
public class Demo2 {

    public static void main(String[] args) {

        int [] arr = {2,7,9,3,1};

        System.out.println(StealingGoldCoins(arr));
    }

    private static int StealingGoldCoins(int[] arr) {

        int sumA=0;
        int sumB=0;
        for (int i = 0; i < arr.length; i++) {
            if(i%2==0) {
                sumA += arr[i];
            }else
            {
                sumB += arr[i];
            }

        }
        return Math.max(sumA, sumB);
    }


}
